﻿@if (false) 
{ 
    // Just use this script to enable jQuery intellisense in Visual Studio. Never render to real HTML.
    <script src="/Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>
}
@{
    ViewBag.Title = "Manage Questions";
    ViewBag.MenuGroup = "Contents";
    ViewBag.MenuName = "ManageQuestions";
    ViewBag.PageHeader = "Manage Questions";
}
@using ORM.Models
@model IList<Question>
@(Html.Telerik().Grid(Model)
    .Name("Questions")
    .DataKeys(dataKeys => dataKeys.Add(c => c.Id))
    .Columns(columns =>
    {
        columns.Template(
            @<text>
                 <a href="/Guide/Details/@item.Id" title="@item.Title">@item.Title</a>
            </text>).Width("350px").Title("Title");
         columns.Template(
                @<text>
                <a href="/admin/ManageUsers/Details/@item.PostedBy.Id">@item.PostedBy.Username</a>
                </text>
               ).Width("150px").Title("Posted By");
        columns.Bound(o => o.PostedDate).Format("{0:dd/MM/yyyy HH:mm}").Width("130px");
         columns.Template(
             @<text> 
               <a class="t-button t-grid-edit t-button-icontext" href="/Question/Edit/@item.Id" target="_blank">
                    <span class="t-icon t-edit"></span>Edit</a>
                @Html.Partial("_DeleteButton", new ActionInfo("Delete", "DeleteQuestion") { Id = item.Id })
            </text>
         );
    })
           .Pageable(pager => pager.PageSize(AppConfigs.DefaultAdminGridPageSize))
           .Sortable()
           .Scrollable(scrolling => scrolling.Enabled(true).Height(350))
                    )

<script type="text/javascript">
    $(document).ready(function () {
        $(".t-grid-delete").click(function (e) {
            if (!confirm("Are you sure you want to delete this Question?")) {
                return false;
            }
        });
    });
</script>